const http = require('http');

// 测试数据
const testData = {
  "response": {
    "data": [
      {
        "data": [
          {
            "order": {
              "id": "ORDER_TEST_001",
              "purchaserId": "CUSTOMER_TEST_001",
              "orderTotalFee": "1500.00",
              "status": "4",
              "createdAt": "2025-11-24T15:55:00.000Z",
              "platformSource": "zcy",
              "invoiceStatus": "invoiced"
            },
            "items": [
              {
                "itemId": "ITEM_TEST_001",
                "itemName": "测试产品1",
                "quantity": "3",
                "skuPrice": "500.00",
                "amount": "1500.00"
              }
            ]
          }
        ]
      }
    ]
  }
};

const data = JSON.stringify(testData);

const options = {
  hostname: '127.0.0.1',
  port: 9001,
  path: '/api/v1/plugin/data/receive',
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'Content-Length': data.length
  }
};

const req = http.request(options, res => {
  console.log(`状态码: ${res.statusCode}`);
  
  res.on('data', d => {
    process.stdout.write(d);
  });
});

req.on('error', error => {
  console.error('请求错误:', error);
});

req.write(data);
req.end();